﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace Kona.Data
{
    public abstract class AdoMdParameter<TParameterType>:IAdoMdParameter
    {

        public TParameterType Value
        { get; set; }

        internal protected AdoMdParameter(TParameterType value, string name)
        {
            this.InitializeParameterToDefaults();
            this.Value = value;
            this.ParameterName = name;
        }

        internal protected AdoMdParameter(TParameterType value, string name, System.Data.DbType dbType)
        {
            this.InitializeParameterToDefaults();
            this.Value = value;
            this.ParameterName = name;
            this.DbType = dbType;
        }


        private void InitializeParameterToDefaults()
        {
            this.DbType = DbType.String;
            this.Direction = ParameterDirection.Input;
            this.IsNullable = false;
            this.ParameterName = string.Empty;
            this.Precision = 0;
            this.Scale = 0;
            this.SourceColumn = string.Empty;
            this.SourceVersion = DataRowVersion.Current;
        }

        #region Implementation of IDataParameter

        public DbType DbType { get; set; }
        public ParameterDirection Direction { get; set; }
        public bool IsNullable { get; private set; }
        public string ParameterName { get; set; }
        public string SourceColumn { get; set; }
        public DataRowVersion SourceVersion { get; set; }
        object IDataParameter.Value
        {
            get { throw new System.NotImplementedException(); }
            set { throw new System.NotImplementedException(); }
        }

        #endregion

        #region Implementation of IDbDataParameter

        public byte Precision { get; set; }
        public byte Scale { get; set; }
        public int Size { get; set; }

        #endregion

        #region Implementation of ICloneable

        public object Clone()
        {
            throw new System.NotImplementedException();
        }

        #endregion
    }
}
